package common

import (
	"gin/pkg"

	"github.com/jinzhu/gorm"
)

//根据人物姓名删除
func DeletePInfo(db *gorm.DB, name string) {
	err := db.Table("person").Where("pname=?", name).Delete("person").Error
	pkg.ErrCheck(err)
}

//删除对应两个人物关系
func DeletePRelation(db *gorm.DB, name1 string, name2 string) {
	err := db.Table("person_relationship").Where("pri_pname=? and cor_pname=?", name1, name2).
		Or("pri_pname=? and cor_pname=?", name2, name1).
		Delete("person_relationship").Error
	pkg.ErrCheck(err)
}
